﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="zh-CN">
<head>
<title></title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css"
	href="${rootPath}/Styles/admin-all.css" />
<link rel="stylesheet" type="text/css"
	href="${rootPath}/Styles/base.css" />
<script type="text/javascript" src="${rootPath}/Scripts/jquery-1.7.2.js"></script>
<script type="text/javascript"
	src="${rootPath}/Scripts/jquery-ui-1.8.22.custom.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="${rootPath}/Styles/ui-lightness/jquery-ui-1.8.22.custom.css" />
<link rel="stylesheet" type="text/css"
	href="${rootPath}/Styles/formui.css" />
<script type="text/javascript" src="${rootPath}/Scripts/tb.js"></script>
<link href="${rootPath}/bootstrap/css/bootstrap.min.css"
	rel="stylesheet">
<link rel="stylesheet"
	href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
	integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
	crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="${rootPath}/Styles/bt.css" />
<script type="text/javascript">
function checkEmail() {
	/* 获取属性对象 校验邮箱 */
	var email = $("#email").val;
	// 获取span对象
	var span = $("#emailSpan");
	// 创建正则表达式
	var reg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
	// 开始校验
	if (email == "" || email == null) {
		span.innerHTML = "*邮箱不能为空"
		span.style.color = "red";
	} else if (reg.test(email)) {
		span.innerHTML = "邮箱正确";
		span.style.color = "green";
	} else {
		span.innerHTML = "*邮箱格式不正确"
		span.style.color = "red";
	}
}

function checkpassword() {
	// 获取邮箱密码对象
	var password = $("#password").val;
	// 获取span对象
	var span = $("#passwordSpan");
	// 创建正则表达式
	var reg = /^[0-9a-zA-Z_#]{6,16}$/;
	// 开始校验
	if (password == "" || password == null) {
		span.innerHTML = "*密码不能为空"
		span.style.color = "red";
	} else {
		span.innerHTML = "*密码格式不正确"
		span.style.color = "red";
	}
}

function checkAddress() {
	// 获取地址对象
	var address = $("#address").val;
	// 获取span对象
	var span = $("#addressSpan");
	// 开始校验
	if (address == "" || address == null) {
		span.innerHTML = "*地址不能为空";
		span.style.color = "red";
	}
}

function checkSex() {
	// 获取性别对象
	var sex = $("#sex").val;
	// 获取span对象
	var span = $("#sexSpan");
	// 开始校验
	if (sex == 0) {
		span.innerHTML = "*性别不能为请选择";
		span.style.color = "red";
		return false;
	} else {
		span.innerHTML = "*性别ok";
		span.style.color = "green";
		return true;
	}
}

function checkName() {
	// 获取姓名对象
	var name = $("#name").val;
	// 获取span对象
	var span = $("#nameSpan");
	// 创建正则表达式
	var reg = /^[\u4e00-\u9fa5]{2,4}$/;
	// 开始校验
	// 开始校验
	if (name == "" || name == null) {
		span.innerHTML = "*用户名不能为空"
		span.style.color = "red";
	} else if (reg.test(name)) {
		span.innerHTML = "用户名正确";
		span.style.color = "green";
	} else {
		span.innerHTML = "*用户名格式不正确"
		span.style.color = "red";
	}
}

function checkIdentity() {
	// 获取身份证对象
	var identity = $("#identity").val;
	// 获取span对象
	var span = $("#identitySpan");
	// 创建正则表达式
	var reg = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
	// 开始校验
	if (identity == "" || identity == null) {
		span.innerHTML = "*身份证号码不能为空";
		span.style.color = "red";
	} else if (reg.test(identity)) {
		span.innerHTML = "*身份证号码正确";
		span.style.color = "green";
	} else {
		span.innerHTML = "*身份证号码格式错误";
		span.style.color = "red";
	}
}
function checkPhone(){
	// 获取手机号对象
	var phone=$("#phone").val;
	// 获取span对象
	var span=$("#phoneSpan");
	// 创建正则表达式
	var reg=/^1[345678]\d{9}$/;
	// 开始校验
	if(phone=="" || phone==null){
		span.innerHTML = "*手机号码不能为空";
		span.style.color = "red";
	}else if(reg.test(phone)){
		span.innerHTML = "*手机号码正确";
		span.style.color = "green";
	}else{
		span.innerHTML = "*手机号码格式错误";
		span.style.color = "red";
	}
}
</script>
</head>
<body>
	<form action="${rootPath}/usermanage/addUserSubmit.html" method="post"
		class="form-horizontal">
		<div class="alert alert-info">
			当前位置<b class="tip"></b>用户添加
		</div>
		<div class="body">

			<div class="form-group">
				<label for="user">邮箱</label> <input type="text" name="email"
					id="email" value="" class="form-control" placeholder="邮箱" /><span
					id="emailSpan"></span>
			</div>
			<div class="form-group">
				<label for="user">邮箱密码</label> <input type="password"
					name="password" id="password" value="" class="form-control"
					placeholder="邮箱密码" /><span id="passwordSpan"></span>
			</div>
			<div class="form-group">
				<label for="user">地址</label> <input type="text" name="address"
					id="address" value="" class="form-control" placeholder="地址" /><span
					id="addressSpan"></span>
			</div>
			<label for="sex">性别</label> <select class="form-control" name="sex"
				id="sex">
				<option value="0">请选择</option>
				<option value="1">男</option>
				<option value="2">女</option>
			</select><span id="sexSpan"></span>
			<div class="form-group">
				<label for="user">姓名</label> <input type="text" name="name"
					id="name" value="" class="form-control" placeholder="姓名" /><span
					id="nameSpan"></span>
			</div>
			<div class="form-group">
				<label for="user">身份证</label> <input type="text" name="identity"
					id="identity" value="" class="form-control" placeholder="身份证" /><span
					id="identitySpan"></span>
			</div>
			<div class="form-group">
				<label for="user">联系电话</label> <input type="text" name="phone"
					id="phone" value="" class="form-control" placeholder="联系电话" /><span
					id="phoneSpan"></span>
			</div>
			<label for="sex">状态</label> <select class="form-control"
				name="status" id="status">
				<option value="0">禁用</option>
				<option value="1">启用</option>
			</select><span id="statusSpan"></span>
			<button type="submit" id="sub" class="btn btn-success">提交</button>
			<button type="button" id="but" class="btn btn-warning">重置</button>
		</div>
		</div>
	</form>
	<div class="container">
		<div class="col-sm-8 col-sm-offset-1">${info }</div>
	</div>
</body>
</html>
